import Vue from 'vue'
import VueRouter from 'vue-router'


Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    redirect:"/login"
  },
  {
    path: '/login',
  	component:() => import('../views/Login.vue'),
  },
  {
    path: '/home',
    name: 'Home',
    component:() => import('../views/Home.vue'),
    children:[
      {
        path: '/main',
    name: 'main',
    component:() => import('../views/Main.vue'),
        
      },
      {
        path: '/userinformation',
        name: 'userinformation',
        component:() => import('../views/home/UserInformation.vue'),
        meta:{comp:"/userinformation",pathname:"用户管理",name:"用户信息查询"}
      },
      {
        path: '/administrators',
        name: 'administrators',
        component:() => import('../views/home/Administrators.vue'),
        meta:{comp:"/administrators",pathname:"管理员权限",name:"管理员设置"}
      },
      {
        path: '/goods-add',
        name: 'goodsadd',
        component:() => import('../views/home/goods/GoodsAdd.vue'),
        meta:{comp:"../views/home/goods/GoodsAdd.vue",pathname:"商品管理",name:"添加商品"}
      },
      {
        path: '/phonerecycle',
        name: 'phonerecycle',
        component:() => import('../views/home/PhoneRecycle.vue'),
        meta:{comp:"/phonerecycle",pathname:"商品管理",name:"手机回收"}
      },
      // {
      //   path: '/phonerecycle-upload/:id',
      //   name: 'phonerecycle-upload',
      //   component:() => import('../views/home/PhoneRecycleUpload.vue'),
      //   meta:{comp:"/phonerecycle-upload/:id",pathname:"商品管理",name:"手机信息修改"}
      // },
      {
        path: '/padrecycle',
        name: 'padrecycle',
        component:() => import('../views/home/PadRecycle.vue'),
        meta:{comp:"/padrecycle",pathname:"商品管理",name:"平板电脑回收"}
      },
      {
        path: '/laptoprecycle',
        name: 'laptoprecycle',
        component:() => import('../views/home/LaptopRecycle.vue'),
        meta:{comp:"/laptoprecycle",pathname:"商品管理",name:"笔记本回收"}
      },
      {
        path: '/camerarecycle',
        name: 'camerarecycle',
        component:() => import('../views/home/CameraRecycle.vue'),
        meta:{comp:"/camerarecycle",pathname:"商品管理",name:"摄影摄像回收"}
      },
      {
        path: '/smartrecycle',
        name: 'smartrecycle',
        component:() => import('../views/home/SmartRecycle.vue'),
        meta:{comp:"/smartrecycle",pathname:"商品管理",name:"智能数码回收"}
      },
      {
        path: '/goods-add',
        name: 'goods-add',
        component:() => import('../views/home/goods/GoodsAdd.vue'),
        meta:{comp:"/goods-add",pathname:"商品管理",name:"添加商品"}
      },
      {
        path: '/notice',
        name: 'notice',
        component:() => import('../views/home/Notice.vue'),
        meta:{comp:"/notice",pathname:"广告管理",name:"公告"}
      },
      {
        path: '/pmd',
        name: 'pmd',
        component:() => import('../views/home/Pmd.vue'),
        meta:{comp:"/pmd",pathname:"广告管理",name:"跑马灯"}
      },
      {
        path: '/mail',
        name: 'mail',
        component:() => import('../views/home/Mail.vue'),
        meta:{comp:"/mail",pathname:"邮件管理",name:"邮件查询"}
      },
      {
        path: '/ban',
        name: 'ban',
        component:() => import('../views/home/Ban.vue'),
        meta:{comp:"/ban",pathname:"封禁",name:"封禁查询"}
      },
    ]
  }
]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})
const VueRouterPush = VueRouter.prototype.push
VueRouter.prototype.push = function push (to) {
  return VueRouterPush.call(this, to).catch(err => err)
}
export default router
